package com.artPreter.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDate;

import lombok.Getter;
import lombok.Setter;

/**
 * <p>
 * 点位湿度温度日平均记录表
 * </p>
 *
 * @author Jarvis_He
 * @since 2024-04-23
 */
@Getter
@Setter
@TableName("jv_device_day_average")
public class DeviceDayAverage implements Serializable {

    private static final long serialVersionUID = 1L;

    //ID")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    //创建时间")
    @TableField("create_time")
    private Long createTime;

    //排序")
    @TableField("sort")
    private Integer sort;

    //备注")
    @TableField("remarks")
    private String remarks;

    //1启用")
    @TableField("status")
    private Integer status;

    //温度数值")
    @TableField("temp_val")
    private Double tempVal;

    //湿度数值")
    @TableField("hum_val")
    private Double humVal;

    //是否超出阀值")
    @TableField("is_over")
    private Integer isOver;

    //区域id")
    @TableField("position")
    private String position;

    //楼层id")
    @TableField("floor")
    private String floor;

    //房间id")
    @TableField("room")
    private String room;

    //温控设备id")
    @TableField("device_id")
    private String deviceId;

    //阀值")
    @TableField("over_value")
    private String overValue;

    //日")
    @TableField("day")
    private Integer day;

    //月")
    @TableField("month")
    private Integer month;

    //年")
    @TableField("year")
    private Integer year;


    @TableField(exist = false)
    private Integer num = 0;

    public DeviceDayAverage() {
    }

    public DeviceDayAverage(TempHumMemo tempHumMemo) {
        this.createTime = tempHumMemo.getCreateTime();

        this.remarks = tempHumMemo.getRemarks();


        this.tempVal = tempHumMemo.getTempVal();

        this.humVal = tempHumMemo.getHumVal();

        this.isOver = tempHumMemo.getIsOver();

        this.position = tempHumMemo.getPosition();

        this.floor = tempHumMemo.getFloor();

        this.room = tempHumMemo.getRoom();

        this.deviceId = tempHumMemo.getDeviceId();

        LocalDate currentDate = LocalDate.now();

        this.year= currentDate.getYear();

        this.month = currentDate.getMonthValue();

        this.day = currentDate.getDayOfMonth();

        this.num = 1;




    }
}
